package com.xjoyt.pay.share.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

@Entity
@Table(name = "t_bucket")
public class Bucket {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "bucket_id", length = 36)
	public String id;

	/**
	 * 阿里云OSS端点
	 */
	@Column(name = "endpoint", length = 50)
	public String endpoint;

	/**
	 * 阿里云KEY
	 */
	@Column(name = "access_key", length = 50)
	public String accessKey;

	/**
	 * 阿里云密钥
	 */
	@Column(name = "secret_key", length = 50)
	public String secretKey;

	/**
	 * 阿里云OSS名称
	 */
	@Column(name = "bucket_name", length = 50)
	public String name;

	/**
	 * 是否启用
	 */
	@Column(name = "is_enabled")
	@org.hibernate.annotations.Type(type = "yes_no")
	public Boolean enabled;

	/**
	 * 默认存储
	 */
	@Column(name = "is_default")
	@org.hibernate.annotations.Type(type = "yes_no")
	public Boolean defaultBucket;

	/**
	 * 添加日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

}
